package com.duobao.view;

import com.duobao.game.DuobaoSwingLaunch;
import com.duobao.uitl.BackImage;
import com.duobao.uitl.myFont;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class StartPanel extends JPanel implements MouseListener {
    BackImage background;
    JLabel jlb1, jlb2, jlb3;
    DuobaoSwingLaunch jframe;

    public StartPanel(DuobaoSwingLaunch g) {
        jframe = g;
        this.setLayout(null);

        jlb1 = new JLabel("重新开始");
        jlb1.setFont(myFont.f);
        jlb1.setForeground(Color.BLACK);
        jlb1.setBounds(300, 350, 110, 30);
        this.add(jlb1);
        jlb1.addMouseListener(this);

        jlb2 = new JLabel("继续游戏");
        jlb2.setFont(myFont.f);
        jlb2.setForeground(Color.BLACK);
        jlb2.setBounds(300, 380, 110, 30);
        this.add(jlb2);
        jlb2.addMouseListener(this);

        jlb3 = new JLabel("退出游戏");
        jlb3.setFont(myFont.f);
        jlb3.setForeground(Color.BLACK);
        jlb3.setBounds(300, 410, 110, 30);
        jlb3.addMouseListener(this);
        this.add(jlb3);


        background = new BackImage("image/taohua.jpg");
        background.setBounds(0, 0, 700, 500);
        this.add(background);
    }

    public void mouseClicked(MouseEvent e) {
        // TODO Auto-generated method stub
        if (e.getSource() == this.jlb1) {

        } else if (e.getSource() == this.jlb2) {

        } else if (e.getSource() == this.jlb3) {
            jframe.dispose();
        }
    }

    public void mouseEntered(MouseEvent e) {

        ((JLabel) e.getSource()).setForeground(Color.PINK);
        ((JLabel) e.getSource()).setCursor(new Cursor(Cursor.HAND_CURSOR));
    }

    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub
        ((JLabel) e.getSource()).setForeground(Color.BLACK);
        ((JLabel) e.getSource()).setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }

    public void mousePressed(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    public void mouseReleased(MouseEvent e) {
        // TODO Auto-generated method stub

    }

}
